﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Enterprise.Migrations
{
    public partial class edittablename : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MDT_COMMENTS");

            migrationBuilder.DropTable(
                name: "MDT_ORDERS");

            migrationBuilder.CreateTable(
                name: "MDT_COMMENT",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    MDT_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    COMMENT = table.Column<string>(type: "TEXT", nullable: true),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_COMMENT", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_ORDER",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    MDT_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    ORDER_NO = table.Column<int>(type: "INT", nullable: false),
                    ORDER_SUB_NO = table.Column<int>(type: "INT", nullable: false),
                    TEMPLATE_TYPE = table.Column<int>(type: "INT", nullable: false),
                    ORDER_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DRUG_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    REPEAT_INDICATOR = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    ORDER_TEXT = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    ORDER_CODE = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SPEC = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DOSAGE = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    DOSAGE_UNITS = table.Column<string>(type: "VARCHAR(8)", nullable: true),
                    FIRM_ID = table.Column<string>(type: "VARCHAR(30)", nullable: true),
                    FREQUENCY = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    ADMINISTRATION = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    DURATION = table.Column<int>(type: "INT", nullable: false),
                    DURATION_UNITS = table.Column<string>(type: "VARCHAR(4)", nullable: true),
                    FREQ_DETAIL = table.Column<string>(type: "VARCHAR(80)", nullable: true),
                    SUB_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    EXAM_REASON = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    EXAMEPART = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SPECIMEN = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PERFORM_STATUS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PERFORM_ORDER_NO = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    CREATED_BY_NAME = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_ORDER", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MDT_COMMENT");

            migrationBuilder.DropTable(
                name: "MDT_ORDER");

            migrationBuilder.CreateTable(
                name: "MDT_COMMENTS",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    COMMENT = table.Column<string>(type: "TEXT", nullable: true),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    MDT_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_COMMENTS", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_ORDERS",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ADMINISTRATION = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    CREATED_BY_NAME = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    DOSAGE = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    DOSAGE_UNITS = table.Column<string>(type: "VARCHAR(8)", nullable: true),
                    DRUG_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DURATION = table.Column<int>(type: "INT", nullable: false),
                    DURATION_UNITS = table.Column<string>(type: "VARCHAR(4)", nullable: true),
                    EXAM_REASON = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    EXAMEPART = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    FIRM_ID = table.Column<string>(type: "VARCHAR(30)", nullable: true),
                    FREQ_DETAIL = table.Column<string>(type: "VARCHAR(80)", nullable: true),
                    FREQUENCY = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    MDT_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    ORDER_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    ORDER_CODE = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    ORDER_NO = table.Column<int>(type: "INT", nullable: false),
                    ORDER_SUB_NO = table.Column<int>(type: "INT", nullable: false),
                    ORDER_TEXT = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    PERFORM_ORDER_NO = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PERFORM_STATUS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    REPEAT_INDICATOR = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SPEC = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SPECIMEN = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SUB_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    TEMPLATE_TYPE = table.Column<int>(type: "INT", nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_ORDERS", x => x.Id);
                });
        }
    }
}
